#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTabWidget>
#include <QTextBrowser>
#include <QPlainTextEdit>
#include <QLineEdit>
#include <QPushButton>
#include <QList>
#include "deepseekapi.h"
#include "ollamaapi.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void sendMessage();
    void newConversation();
    void closeConversation(int index);
    void onResponseReceived(const QString &response, const QString &conversationId);
    void onResponseReceived(const QString &conversationId);
    void onStreamResponseStarted(const QString &chunk, const QString &conversationId);
    void onStreamResponseReasoningContent(const QString &chunk, const QString &conversationId);
    void onStreamResponseReceived(const QString &chunk, const QString &conversationId);
private:
    Ui::MainWindow *ui;
    DeepSeekAPI *deepSeekAPI;
    OllamaAPI *ollamaAPI;
    QMap<QString,QString> m_mapMsg;

    QString renderMarkdown(const QString &markdown);
};

#endif // MAINWINDOW_H
